import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false

import request from 'utils/request.js'
Vue.prototype.request = request
import upload from 'utils/upload.js'
Vue.prototype.upload = upload
import config from 'config/config.js'
Vue.prototype.config = config
import amap from 'utils/amap.js'
Vue.prototype.amap = amap

Vue.filter('imageUrl', (str) => {
	return config.image_url + str
})

Vue.filter('formattingTime', (str) => {
	console.log(str);
	if (!str) return ''
	let date = new Date(str * 1000)
	let year = date.getFullYear()
	let month = date.getMonth() + 1
	month = month < 10 ? '0' + month : month
	let day = date.getDate()
	day = day < 10 ? '0' + day : day
	let hours = date.getHours()
	hours = hours < 10 ? '0' + hours : hours
	let minutes = date.getMinutes()
	minutes = minutes < 10 ? '0' + minutes : minutes
	let seconds = date.getSeconds()
	seconds = seconds < 10 ? '0' + seconds : seconds
	// return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
	return year + '-' + month + '-' + day
})

// 引入uview框架
import uView from 'uview-ui'
Vue.use(uView)

App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif